fix(mavlink): Allowing custom modes to request offboard setpoints via the external mode registration#26949
Conversation
Pedro-Roque
left a comment
There was a problem hiding this comment.
Not sure if I prefer this version much more... Also perhaps it could be a good idea to aggregate multiple requests to change message versions before doing so for adding one extra field, unless urgent. Otherwise we will end up with large version numbers soon.
I agree about the message versions. I just bumped the version because otherwise the CI tests complain. |
|
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/px4-dev-call-apr-08-2026-team-sync-and-community-q-a/48785/1 |
Yes, in fact, I was also quite conflicted about whether the message version should be changed when modifying the code. In any case, I hope everyone present can discuss and reach a conclusion as soon as possible. After the merge, I will immediately apply this technology to industry-level scenarios, which was my original intention when I first submitted the PR. |
bkueng
left a comment
There was a problem hiding this comment.
This looks good.
Longer-term I think it needs a better solution though. Rather than mc_raptor registering as external mode, it should register itself as a controller with the setpoint types it accepts. Then adding a mechanism to select the controller(s) at runtime (either by the mode, or something else).
This would make it more flexible allowing internal or external modes to use different controllers.
|
Thanks @bkueng ! |
Solved Problem
Fixes #26768
Solution
This PR implements Alternative 1
Changelog Entry
For release notes:
Alternatives
request_offboard_setpointsin the external mode registration. This needs to be reflected in thevehicle_statusbecause that is the main source determining the behavior of themavlink_receiver.cppvehicle_statusmavlink_receiver.cppalways emittrajectory_setpointfor external mode IDstrajectory_setpointitself, they could be conflicting. AFAIK currently onlymc_raptorandmc_nn_controluse the external mode registration from the inside and for external modes it does not matter anyways, so this is not an issueI believe Alternative 1 is the the right approach here. It unambiguously implements the forwarding while neither entangling
mavlink_receiver.cppwith the mode registration (in contrast to GrooveWJH PR) nor adding assumptions about theNAVIGATION_STATE_EXTERNAL{1-8}Context
External modes like
mc_raptorandmc_nn_controlthat use the external mode registration benefit greatly from being able to receive offboard setpoints via MAVLink